Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decomp: camera | cam-combiner | cam-start | cam-update #621

Merged
merged 26 commits into from
Jul 31, 2021

Conversation

xTVaser
Copy link
Member

@xTVaser xTVaser commented Jun 23, 2021

No description provided.

@xTVaser xTVaser changed the title decomp: camera decomp: camera | cam-combiner | cam-start Jun 25, 2021
@xTVaser xTVaser changed the title decomp: camera | cam-combiner | cam-start decomp: camera | cam-combiner | cam-start | cam-update Jun 25, 2021
Copy link
Collaborator

@water111 water111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at cam-start.

There are a few not-implemented things that make this harder than it needs to be (#643 and #642) but those aren't blockers.

I think I will need to add #645 to make the call to cam-start not crash.

)
(let ((a1-2 cam-combiner-init))
)
(t9-3 a0-3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, you should case t9-3 to (function process object function).

This code;

     (let ((a1-2 cam-combiner-init))
      )

is the second argument to the function.

(the-as pointer #x70004000)
)
)
(let ((t9-6 (the-as (function process function) set-to-run))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another (function process object function)

)

;; failed to figure out what this is:
(cam-start #f)
Copy link
Collaborator

@water111 water111 Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this will cause a crash because of the scratchpad thing. I will work on this: #645

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably causing the crash in tests, you can comment this out with a TODO for now. It's probably calling some function we don't have yet.

)
(vector-normalize! s4-0 1.0)
(let* ((v1-1 s4-0))
(set! f0-1 (vector-dot v1-1 arg3))
Copy link
Collaborator

@water111 water111 Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but the decompiler could make it look nicer (#636) and hopefully eliminate f0-1

Copy link
Collaborator

@water111 water111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really close, just a few suggestions on types to clean things up

(let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad)))
(set! (-> sv-240 quad) v1-5)
)
(vector-! s2-0 (-> s5-0 yon-top-left) sv-240)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great to see, the vector-! stuff is working.

(a1-25 (-> *math-camera* guard-plane))
(a2-21 4.0)
)
(t9-22 a0-58 a1-25 a2-21)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda suspicious, but I think will go away once update-visible takes 1 arg

(define *update-leaf-when-outside-bsp* #t)

;; definition for function update-visible
(defun update-visible ((arg0 math-camera) (arg1 int) (arg2 uint) (arg3 uint))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one actually takes only 1 arg.

)
)
(if (and *stats-bsp* (= *master-mode* 'game))
(format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp unk-data-2 0) arg3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably had an error/warning with 1 arg because this format string is incorrectly recognized as taking 2 arguments.

(set! (-> s5-1 all-visible?) #f)
)
(let* ((a0-19 s5-1)
(t9-2 (method-of-object a0-19 dummy-16))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should take more arguments so it ends up used directly in the when below

(set! (-> s5-1 all-visible?) #f)
)
(let* ((a0-24 s5-1)
(t9-3 (method-of-object a0-24 dummy-16))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar thing here

;; definition for function update-camera
;; Used lq/sq
(defun update-camera ()
(local-vars (a3-12 number))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is wrong with this variable

(-> *instance-tie-work* guard-plane 3 quad)
(-> *math-camera* guard-plane 3 quad)
)
(update-visible
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think if you remove the extra arguments from update-visible the weird a3-12 stuff will go away.

(a2-13 (-> *math-camera* inv-camera-rot-smooth-from))
)
(set! a3-12 (-> *math-camera* smooth-t))
(t9-16 a0-42 a1-16 a2-13 (the-as float a3-12))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should get less weird once update-visible is fixed

)

;; failed to figure out what this is:
(cam-start #f)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably causing the crash in tests, you can comment this out with a TODO for now. It's probably calling some function we don't have yet.

@xTVaser xTVaser marked this pull request as ready for review July 29, 2021 01:12
@water111 water111 merged commit d37e6c5 into open-goal:master Jul 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants